package www.openteam.com.ui;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.widget.TextView;

import java.util.zip.Inflater;

import butterknife.Bind;
import butterknife.ButterKnife;
import www.openteam.com.R;

/**
 * Created by kylin on 2016/9/5.
 */
public class BriefIntroductionActivity extends ActionBarActivity {

    @Bind(R.id.tv_instruction)
    TextView  tv_instructions;
    @Bind(R.id.tv_brief)
    TextView tv_brief;
    ActionBar actionBar;
    String mTitle;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_brief);
        ButterKnife.bind(this);
//        String bri=getResources().getString(R.string.company);
//        tv_instructions.setText(bri);
         initData();
        restoreActionBar();
    }

    private void initData() {
        Bundle bundle =this.getIntent().getExtras();
        String brief= bundle.getString("brief");
        if (brief.equals("companyname")){
            mTitle = getResources().getString(R.string.companyname);
            tv_brief.setText(mTitle);
            tv_instructions.setText(R.string.company);
        }else if (brief.equals("erpname")){
            mTitle = getResources().getString(R.string.erpname);
            tv_brief.setText(mTitle);
            tv_instructions.setText(R.string.erp);
        }else if  (brief.equals("evaluatename")){
            mTitle = getResources().getString(R.string.evaluatename);
            tv_brief.setText(mTitle);
            tv_instructions.setText(R.string.evaluate);
        }

    }


    public void restoreActionBar() {

        actionBar = getSupportActionBar();

        // 设置显示标题
        actionBar.setLogo(R.drawable.ic_launcher);
        actionBar.setDisplayUseLogoEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        // 设置标题
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(mTitle);

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:// 点击返回图标事件
                this.finish();
            default:
                return super.onOptionsItemSelected(item);
        }
    }

}
